import { ref } from 'vue'
import { defineStore } from 'pinia'

export const UseInfo_Store = defineStore('user_info', () => {
  const token = ref('')
  const username = ref('')
  const user_avatar = ref('')

  const set_token = (my_token) => {
    token.value = my_token
  }

  const set_use_info = (user_name,avatar) => {
    username.value = user_name
    user_avatar.value = avatar
  } 

  const remove_user_info = () => {
    token.value = ''
    username.value = ''
    user_avatar.value = ''
  }

  return {
     token,
     username,
     user_avatar,
     set_use_info,
     set_token,
     remove_user_info
     }
},
 {
    persist:true
  }  
)
